import java.time.*;
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
class Manager extends User{
    public Manager(String userId,String username,String password,String phone){
        super(userId,username,password,phone,"经理");
    }
    @Override
    public void showMenu(Logger logger,CinemaSystem system){
        Scanner scanner=new Scanner(System.in);
        while(true){
            System.out.println("\n====经理菜单====");
            System.out.println("1.修改自身密码");
            System.out.println("2.重置前台密码");
            System.out.println("3.添加影片");
            System.out.println("4.修改影片信息");
            System.out.println("5.删除影片");
            System.out.println("6.查询影片");
            System.out.println("7.列出所有影片");
            System.out.println("8.添加场次");
            System.out.println("9.修改场次");
            System.out.println("10.删除场次");
            System.out.println("11.列出场次");
            System.out.println("12.自动排片");
            System.out.println("13.查看本日销售数据");
            System.out.println("14.查看本周销售数据");
            System.out.println("15.查看本月销售数据");
            System.out.println("16.退出登录");
            System.out.print("请选择操作");

            int choice = scanner.nextInt();
            scanner.nextLine();

            switch (choice) {
                case 1:
                    System.out.print("输入新密码: ");
                    String newPassword = scanner.nextLine();
                    this.changePassword(newPassword, logger);
                    break;
                case 2:
                    System.out.print("输入要重置密码的前台用户名: ");
                    String username = scanner.nextLine();
                    system.resetFrontDeskPassword(username, logger, this);
                    break;
                case 3:
                    system.addMovie(logger, this);
                    break;
                case 4:
                    System.out.print("输入要修改的影片名称: ");
                    String movieTitle = scanner.nextLine();
                    system.modifyMovie(movieTitle, logger, this);
                    break;
                case 5:
                    System.out.print("输入要删除的影片名称: ");
                    String delMovie = scanner.nextLine();
                    system.deleteMovie(delMovie, logger, this);
                    break;
                case 6:
                    System.out.print("输入查询条件(片名/导演/主演): ");
                    String query = scanner.nextLine();
                    system.queryMovies(query);
                    break;
                case 7:
                    system.listAllMovies();
                    break;
                case 8:
                    system.addSession(logger, this);
                    break;
                case 9:
                    System.out.print("输入要修改的场次ID: ");
                    String sessionId = scanner.nextLine();
                    system.modifySession(sessionId, logger, this);
                    break;
                case 10:
                    System.out.print("输入要删除的场次ID: ");
                    String delSessionId = scanner.nextLine();
                    system.deleteSession(delSessionId, logger, this);
                    break;
                case 11:
                    system.listSessions();
                    break;
                case 12:
                    system.autoSchedule(logger, this);
                    break;
                case 13:
                    system.viewDailySales();
                    break;
                case 14:
                    system.viewWeeklySales();
                    break;
                case 15:
                    system.viewMonthlySales();
                    break;
                case 16:
                    this.logout();
                    return;
                default:
                    System.out.println("无效选择!");
            }
        }
    }
}
